#include <iostream>
#include <algorithm>
#include <cmath>
#define HORSENUMBER 1010

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int horses; //up to 1000
    int tj[HORSENUMBER] = {0}; // 田忌
    int qw[HORSENUMBER] = {0}; // 齐王
    int a;
    int ptj_h, ptj_l;
    int reserved[HORSENUMBER] = {0};
    int i;
    int count;
    bool tjchosen, qwchosen;
    int max_tj, min_tj;
    int max_qw, min_qw;
    long prize;
    while(true)
    {
        cin >> horses;
        count = 0;
        ptj_h = 0;
        ptj_l = 0;
        max_tj = 0;
        min_tj = 2000;
        max_qw = 0;
        min_qw = 2000;
        tjchosen = false;
        qwchosen = false;
        prize = 0;
        for (i = 0; i < horses;i++)
        {
            cin >> a;
            tj[a] += 1;
            if(a>max_tj)
            {
                max_tj = a;
            }
            if(a<min_tj)
            {
                min_tj = a;
            }
        }
        for (i = 0; i < horses;i++)
        {
            cin >> a;
            qw[a] += 1;
            if (a > max_qw)
            {
                max_qw = a;
            }
            if (a < min_qw)
            {
                min_qw = a;
            }
        }
        for (i = 0; i < horses; i++)
        {
            if(qw[i]!=0 && tj[i] != 0)
            {
                reserved[i] = abs(qw[i] - tj[i]);
                qw[i] -= (qw[i] - tj[i]);
                tj[i] -= (qw[i] - tj[i]);
            }
            if(qw[i] >= max_tj && qw[i]!=0)
            {
                for (int j = 0; j < horses;j++)
                {
                    if(tj[j] >0)
                    {
                        tj[j] -= 1;
                        prize -= 200;
                    }
                }
            }
            else
            {
                for (int j = qw[i] + 1; j < horses;)
                {
                    if(tj[j] > 0)
                    {
                        prize += 200;
                        tj[j] -= 1;
                    }
                }
            }
        }
        cout << prize << endl;
    }
    return 0;
}